#!/bin/bash
# author: tangliuxiang

function usage()
{
	echo "USAGE: pull <local> <remote>"
	echo "			- copy file/dir from device to pc"
	echo "Just like the usage of adb pull"
}

if [ "$#" -lt 2 ]; then
	usage
	exit 1
fi

progdir=`dirname $0`/su-tools

check-su 2>&1 > /dev/null

if [ $? == 0 ]; then
	su-pull $@ || exit $?
else
	adb root
	echo "wait for devices..."
	adb wait-for-devices
	adb remount
	adb wait-for-devices
	adb pull $@  || exit $?

	echo ">>> Success pulled $1 to $2"
fi
